@using BlazorApp.Pages.Common.Html.HTable
@using BlazorApp.Pages.Common.Metadata
@using BlazorApp.Pages.Event
@using BlazorApp.Pages.Gateway.Share
@using BlazorApp.Pages.Service
@using k8s.Models
@inherits BlazorApp.Pages.Common.DrawerPageBase<Entity.Crd.Gateway.V1Alpha2TCPRoute>
@if (TcpRoute != null)
{
    <TcpRouteAction Item="TcpRoute" MenuMode="MenuMode.Horizontal"></TcpRouteAction>
    <Divider Orientation="left" Style="font-weight:bold">@L["Metadata"]</Divider>
    <MetadataView Item="TcpRoute.Metadata" ExplainFieldPrefix="tcpRoute"></MetadataView>

    <Divider Orientation="left" Style="font-weight:bold">@L["Parent"]</Divider>
    <RouteParentRefsView ParentRefs="TcpRoute.Spec.ParentRefs"
                         ExplainFieldPrefix="tcpRoute.spec.parentRefs">
    </RouteParentRefsView>

    @if (TcpRoute.Spec.Rules is { Count: > 0 })
    {
        <Divider Orientation="left" Style="font-weight:bold">@L["Rules"]</Divider>
        <HTable Bordered Column="1">
            @foreach (var rule in TcpRoute.Spec.Rules)
            {
                <BackendRefsView BackendRefWithWeight="@rule.BackendRefs" ExplainField="tcpRoute.spec.rules.backendRefs"
                                 Ns="@TcpRoute.Metadata.Namespace()">
                </BackendRefsView>
            }
        </HTable>
    }


    @if (TcpRoute.Status is not null)
    {
        <Divider Orientation="left" Style="font-weight:bold">@L["Status"]</Divider>
        <HTable Bordered Column="1">
            <RouteParentStatusView Parents="@TcpRoute.Status.Parents"
                                   ExplainFieldPrefix="tcpRoute"
                                   Ns="@TcpRoute.Metadata.Namespace()">
            </RouteParentStatusView>
        </HTable>
    }

    @if (_svcList is { Count: > 0 })
    {
        <MiniServiceListView Services="@_svcList"></MiniServiceListView>
    }

    <MiniEventListView Uid="@TcpRoute.Metadata.Uid"></MiniEventListView>
}
